import { fliterPermission } from "@/utils/sys.js";
export const apis = {
  detail: `business/basis/detail?modelCode=MODEL_USER&authCode=BTN_USER_DETAIL`,
  changePassword: `business/user/changePassword?modelCode=MODEL_USER&authCode=BTN_USER_CHANGE_PASSWORD`,
  state: `business/user/state?authCode=BTN_USER_STATE`,
  edit: `business/user/edit?authCode=BTN_USER_EDIT`,
  change: `business/user/change?authCode=BTN_USER_TO_OPREATE`,
};

export const configs = {
  listUrl: "",
  pageOn: true, // 开启分页
  searchOn: true, // 开启搜索
  operateOn: true, //开启操作区域
  treeOn: false, // 开启树形
  searchMode: "custome",
};

export const searchs = [
  {
    type: "Input",
    column: "id",
    label: "用户编号",
  },
  {
    type: "Input",
    column: "user_nick",
    label: "用户昵称",
  },
  {
    type: "Input",
    column: "user_email",
    label: "用户邮箱",
  },
  {
    type: "Input",
    column: "user_phone",
    label: "用户手机",
  },
  {
    type: "Select",
    column: "user_state",
    label: "状态",
    dimCode: "DIM_TYPE_STATE",
  },
  {
    type: "DatePicker",
    column: "ctime",
    label: "创建日期",
  },
];

export const pages = {
  pageSize: 20,
  orders: [
    {
      field: "id",
      sort: "desc",
    },
  ],
};
export const columns = [
  { type: "selection" },
  {
    label: "用户编号",
    column: "id",
    sortable: "custom",
  },

  {
    label: "用户头像",
    column: "user_avatar",
    slot: "userAvatar",
    width: "90",
  },
  {
    label: "用户昵称",
    column: "user_nick",
    display: "text",
    width: "90",
  },
  {
    label: "用户邮箱",
    column: "user_email",
    display: "text",
    width: "90",
  },
  {
    label: "用户手机",
    column: "user_phone",
    display: "text",
    width: "90",
  },
  {
    label: "用户openid",
    column: "user_openid",
    display: "text",
    width: "140",
  },
  {
    label: "用户类型",
    column: "user_type",
    display: "state",
    format: "dim",
    width: "100",
  },
  {
    label: "所属代理",
    column: "user_xs",
    display: "detail",
    format: "model",
    config: {
      mode: "custom",
      component: "manage/components/Mode",
    },
    width: "100",
  },
  {
    label: "计费方案",
    column: "quotation_id",
    display: "detail",
    format: "model",
    config: {
      mode: "custom",
      component: "quotation/components/Mode",
    },
    width: "100",
  },
  {
    label: "状态",
    column: "user_state",
    display: "state",
    format: "dim",
  },
  {
    label: "关注服务号",
    column: "user_openid_zzh",
    slot: "userOpenidZzh",
    width: "100",
  },
  {
    label: "注册小程序",
    column: "user_openid",
    slot: "userOpenid",
    width: "100",
  },
  {
    label: "登录次数",
    column: "user_login",
    width: "100",
  },
  {
    label: "最后登录时间",
    column: "user_last",
    format: "datetime",
    display: "text",
    width: "140",
  },
  {
    label: "创建时间",
    column: "ctime",
    display: "text",
    width: "140",
  },
  { label: "操作", column: "operate", width: "200", fixed: "right" },
];
export const columns2 = [
  { type: "selection" },
  {
    label: "用户编号",
    column: "id",
    sortable: "custom",
  },

  {
    label: "用户头像",
    column: "user_avatar",
    slot: "userAvatar",
    width: "90",
  },
  {
    label: "用户昵称",
    column: "user_nick",
    display: "text",
    width: "90",
  },
  {
    label: "用户邮箱",
    column: "user_email",
    display: "text",
    width: "90",
  },
  {
    label: "用户手机",
    column: "user_phone",
    display: "text",
    width: "90",
  },
  {
    label: "用户openid",
    column: "user_openid",
    display: "text",
    width: "140",
  },
  {
    label: "用户类型",
    column: "user_type",
    display: "state",
    format: "dim",
    width: "100",
  },
  {
    label: "绑定操作员",
    column: "manage_id",
    display: "detail",
    format: "model",
    config: {
      mode: "custom",
      component: "manage/components/Mode",
    },
    width: "100",
  },

  {
    label: "计费方案",
    column: "quotation_id",
    display: "detail",
    format: "model",
    config: {
      mode: "custom",
      component: "quotation/components/Mode",
    },
    width: "100",
  },
  {
    label: "状态",
    column: "user_state",
    display: "state",
    format: "dim",
    width: "100",
  },
  {
    label: "关注服务号",
    column: "user_openid_zzh",
    slot: "userOpenidZzh",
    width: "100",
  },
  {
    label: "登录次数",
    column: "user_login",
    width: "100",
  },
  {
    label: "最后登录时间",
    column: "user_last",
    format: "datetime",
    display: "text",
    width: "140",
  },
  {
    label: "创建时间",
    column: "ctime",

    display: "text",
    width: "140",
  },
  { label: "操作", column: "operate", width: "200", fixed: "right" },
];
export const buttons = fliterPermission([
  {
    operate: "stateOn",
    text: "启用",
    permission: "BTN_USER_STATE",
  },
  {
    operate: "stateOff",
    text: "禁用",
    permission: "BTN_USER_STATE",
  },
]);
export const columnButtons = fliterPermission([
  {
    operate: "edit",
    text: "编辑",
    permission: "BTN_USER_EDIT",
  },
  {
    operate: "detail",
    text: "详情",
    permission: "BTN_USER_DETAIL",
  },
  {
    operate: "change",
    text: "绑定操作员",
    permission: "BTN_USER_TO_OPREATE",
  },
  // {
  //   operate: "changePassword",
  //   text: "初始化密码",
  //   permission: 'BTN_USER_CHANGE_PASSWORD',
  // },
]);
export const columnButtons2 = fliterPermission([
  {
    operate: "edit",
    text: "编辑",
    permission: "BTN_USER_EDIT",
  },
  {
    operate: "detail",
    text: "详情",
    permission: "BTN_USER_DETAIL",
  },
  {
    operate: "change",
    text: "解绑操作员",
    permission: "BTN_USER_TO_OPREATE",
  },
  // {
  //   operate: "changePassword",
  //   text: "初始化密码",
  //   permission: 'BTN_USER_CHANGE_PASSWORD',
  // },
]);
